package com.situ.mall.pattern.observer;

public class Client {
    public static void main(String[] args) {
        //创建一份报纸，作为目标
        NewsPaper subject = new NewsPaper();
        //创建一个读者
        Reader reader1 = new Reader("张三");
        Reader reader2 = new Reader("李四");
        Reader reader3 = new Reader("王五");
        //注册订阅者
        subject.attach(reader1);
        subject.attach(reader2);
        subject.attach(reader3);
        //报纸发布
        subject.setContent("本期是观察者模式");
    }
}
